package com.pactera.asmp.server.dao;

import java.time.LocalDateTime;
import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.pactera.asmp.server.entity.ConstantInfoDTO;
import com.pactera.asmp.server.entity.ConstantInfoSearchDTO;
import com.pactera.asmp.server.entity.ConstantModuleStatisticsDataDTO;
import com.pactera.asmp.server.entity.ConstantStatisticsDataDTO;
import com.pactera.asmp.server.pojo.ConstantInfo;

@Mapper
public interface ConstantInfoMapper {

    List<ConstantInfo> select(ConstantInfoSearchDTO constantInfoSearchDTO);

    int insert(ConstantInfoDTO constantInfoDTO);

    int insertScriptAndConstantRel(@Param("scriptId") Long scriptId, @Param("constantId") Long constantId);

    int update(ConstantInfo constantInfo);

    int deleteByPrimaryKey(@Param("id") Long id, @Param("updateTime") LocalDateTime updateTime);

    int deleteByPrimaryKeys(@Param("datas") List<Long> datas, @Param("updateTime") LocalDateTime updateTime);

    List<Integer> selectScriptIdsByConstantId(@Param("constantId") Long constantId);

    int deleteScriptAndConstantRel(@Param("scriptId") Long scriptId, @Param("constantId") Long constantId);

    List<Long> selectConstantIdsByScriptId(@Param("scriptId") Integer scriptId);

    int updateConstantServiceStatus(@Param("datas") List<Long> datas, @Param("serviceStatus") Integer serviceStatus);

    ConstantInfo selectByNameAndProjectId(@Param("name") String name, @Param("projectId") Integer projectId);

    List<ConstantInfo> selectByIds(@Param("datas") List<Long> datas);

    List<ConstantInfo> selectByProjectModuleIds(@Param("datas") List<Integer> datas);

    ConstantStatisticsDataDTO summaryConstantByProjectId(@Param("projectId") Integer projectId);

    List<ConstantModuleStatisticsDataDTO> summaryModuleConstantByProjectId(@Param("projectId") Integer projectId);

    Long summaryConstantCountByProjectId(@Param("projectId") Integer projectId);
}
